package com.sunnuwell.demo.vo;

import com.sunnuwell.demo.entity.Role;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.CollectionUtils;

import java.util.Date;
import java.util.List;

/**
 * @program: entry
 * @description: 用户请求vo
 * @author: Mr.lv
 * @create: 2019-04-24 11:48
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserRquest {
    private String cid;
    private String username;
    private String password;
    private Integer sex;
    private String headImage;
    private String phone;
    private Date Birthday;
    private String hobby;
    private String address;
    private Integer pageNumber;
    private Integer pageSize;
    private List<Role> roleList;

    public boolean validate() {

        return username != null && password != null && !username.equals("") && !password.equals("");
    }

    public boolean validateUserName() {

        return username != null;
    }

    public boolean validateSearch() {

        return pageNumber != null && pageNumber != 0 && pageSize != null && pageSize != 0;
    }


    public boolean validateAll() {

        return cid != null && username != null && password != null && sex != null && headImage != null && phone != null
                && Birthday != null && hobby != null && address != null;
    }

}